﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using WebUI.Helper;

namespace WebUI.Con
{
    public class QueryController:Controller
    {
        public ActionResult index()
        {
            return View();
        }
        /// <summary>
        /// 显示数据
        /// </summary>
        /// <returns></returns>
        public ActionResult CheckoutList()
        {

            //Convert.ToInt32(Request["pageIndex"]);
            //Convert.ToInt32(Request["pageSize"]);
            if (Request["pageIndex"] != null && Request["pageIndex"].ToString() != "")
            {
                var ChkL = OperateContext.Current.BLLSession.ICheckoutBLL.GetPagedList(Convert.ToInt32(Request["pageIndex"]) + 1, Convert.ToInt32(Request["pageSize"]), s => s.CheckoutID > 0, s => s.CheckoutTime).Select(s => new Model.ViewModel.CheckoutList()
                {
                    CheckoutID = s.CheckoutID,
                    CheckoutUserName = s.UserDB.NickName,
                    CheckoutTime = (s.CheckoutTime ?? DateTime.Now).ToString("yy年MM月dd日hh时mm分"),
                    ShiftName = s.Shift.ShiftName
                }).ToList();

                return Json(ChkL, JsonRequestBehavior.AllowGet);
            }
            else {
                return null;
            }
        }
        [Common.Attributes.Skip]
        public ActionResult Checkout_List_TotalPage()
        {
            int CheckoutTotalPage = OperateContext.Current.BLLSession.ICheckoutBLL.GetListBy(s => s.CheckoutID > 0).Count;
            return Json(CheckoutTotalPage,JsonRequestBehavior.AllowGet);
        }
    }
}
